********************************************************************************
**** Government Finance and the Imposition of Serfdom After the Black Death ****
**** Replication files ****
**** Margaret E. Peters ****
**** July 2022 ****

version 13.1


***********************************
************* PAPER ***************
***********************************


*********************
*** Figure 1 created in ArcGIS
*********************

*from gis, uses map data I am unable to share


*******************
**** Figure 2 *****
*******************


import excel "French serfdom laws from Johnson & Koyama.xlsx", sheet("Sheet1") firstrow clear

set scheme plotplain

gen quarter=.
replace quarter=1 if year>=1400 & year<1425
replace quarter=2 if year>=1425 & year<1450
replace quarter=3 if year>=1450 & year<1475
replace quarter=4 if year>=1475 & year<1500

replace quarter=5 if year>=1500 & year<1525
replace quarter=6 if year>=1525 & year<1550
replace quarter=7 if year>=1550 & year<1575
replace quarter=8 if year>=1575 & year<1600

replace quarter=9 if year>=1600 & year<1625
replace quarter=10 if year>=1625 & year<1650
replace quarter=11 if year>=1650 & year<1675
replace quarter=12 if year>=1675 & year<1700

replace quarter=13 if year>=1700 & year<1725
replace quarter=14 if year>=1725 & year<1750
replace quarter=15 if year>=1750 & year<1775
replace quarter=16 if year>=1775 & year<1800

collapse (sum) terrier judges peages coree weights, by(quarter)

label define qs 1 "1400-1424" 2 "1425-1449" 3 "1450-1474" 4 "1475-1500"  5 "1500-1524" 6 "1525-1549" 7 "1550-1574" 8 "1575-1600"  9 "1600-1624" 10 "1625-1649" 11 "1650-1674" 12 "1675-1700"  13 "1700-1724" 14 "1725-1749" 15 "1750-1774" 16 "1775-1800"

label values quarter qs
label variable quarter "Year"
label variable terrier "Terrier"
lab var judges "Justice"
lab var peages "Peages"
lab var coree "Corvee"
lab var weights "Weights & Measures"



twoway (bar terrier quarter) (bar judges quarter) (bar peages quarter) (bar coree quarter) (bar weights quarter),  ytitle(Number of Arrets or Edicts) xtitle(Year) xlabel(1(1)16, angle(forty_five) valuelabel)



*******************
**** Figure 3 *****
**** Table 2  *****
*******************
use "serfdom_master.dta", clear

gen serfdom2=0
replace serfdom2=1 if serfdom>0

label define bor 0 "Had Not Borrowed" 1 "Had Borrowed"

label values borrow bor

*Figure 3a
graph bar if serfdom2==1, over(borrow) label saving(f3a, replace)  ytitle("% States with Serfdom") title("A. Borrowing by States that Imposed Serfdom")
*gr save Figure_3a



*Table 2
tabulate serfdom2 borrow, chi2 column

*Figure 3b

preserve
  collapse (sum) borrow serfdom2, by(short_name)
  save "borrowing_serfdom_byentity.dta", replace
restore

use "borrowing_serfdom_byentity.dta", clear
replace serfdom2=0 if short_name=="Aragón"
rename serfdom2 serfdom

gen borrow2=.
replace borrow2=0 if borrow==0
replace borrow2=1 if borrow>0


gen serfdom2=.
replace serfdom2=0 if serfdom==0
replace serfdom2=1 if serfdom>0
tab serfdom serfdom2

list short_name if borrow2==1 & serfdom2==1

replace borrow2=0 if short_name=="Castile" | short_name=="England" | short_name=="France" | short_name=="Papal States"

label define serf 0 "No Serfdom" 1 "Serfdom"
label values serfdom2 serf
graph bar if borrow2==1, over(serfdom2) label saving(f3b, replace) ytitle("% States that Borrowed") title("B. Experience with Serfdom of States that Borrowed")
*gr save Figure_3b

gr combine "f3a" "f3b"



************************************
**** Statistics page 24, fn 30 *****
************************************
use "serfdom_master.dta", clear


gen serfdom2=0
replace serfdom2=1 if serfdom>0


gen fincrisis4=0
replace fincrisis4=1 if year>=1378 & year<=1382
replace fincrisis4=1 if year>=1389 & year<=1393
replace fincrisis4=1 if year>=1392 & year<=1396
replace fincrisis4=1 if year>=1450 & year<=1455
replace fincrisis4=1 if year>=1472 & year<=1500
replace fincrisis4=1 if year>=1557 & year<=1563
replace fincrisis4=1 if year>=1575 & year<=1579
replace fincrisis4=1 if year>=1594 & year<=1598
replace fincrisis4=1 if year>=1607 & year<=1611
replace fincrisis4=1 if year>=1607 & year<=1612
replace fincrisis4=1 if year>=1624 & year<=1628
replace fincrisis4=1 if year>=1627 & year<=1631
replace fincrisis4=1 if year>=1634 & year<=1638
replace fincrisis4=1 if year>=1647 & year<=1651
replace fincrisis4=1 if year>=1648 & year<=1650
replace fincrisis4=1 if year>=1652 & year<=1656
replace fincrisis4=1 if year>=1661 & year<=1665
replace fincrisis4=1 if year>=1662 & year<=1666
replace fincrisis4=1 if year>=1683 & year<=1687


tabulate serfdom2 fincrisis4, chi2 column

******************
**** Figure 4 ****
******************

**Put together cities dataset
use "parliaments replication final", clear
gen city2=upper(city)
rename indicator citycode
merge m:m city2 year using "cities_additional_location_coding.dta"
list country year city if _merge==1 & year>=1300
duplicates list citycode city year
duplicates drop  citycode city year, force
drop if citycode==.
tsset citycode year


replace citypop=. if citypop==-999
summarize citypop if citypop!=.
replace citypop=citypop*1000
summarize citypop
gen citypop2=citypop
replace citypop2=0 if citypop==.
replace citypop_le5=citypop_le5*1000

gen numcities=1

foreach var in citypop citypop2 citypop_le5 {
gen ln`var'=log(`var'+1)
by citycode, sort: gen l`var'=`var'[_n-1]
by citycode, sort: gen d`var'=`var'-l`var'
}





foreach var in serfdom_inyear serfdom_inyear_smallfree {
gen `var'_any=0
replace `var'_any=1 if `var'>=1
replace `var'_any=. if `var'==.

gen `var'_any2=0
replace `var'_any2=1 if `var'>=1
replace `var'_any2=0 if `var'==.
}

save "serfcitygrowth_rep.dta", replace
 
**Put together territory data

use "serfcitygrowth_rep.dta", clear

**Add new
*Ottoman
foreach var in serfdom_inyear serfdom_inyear_smallfree {
replace `var'=4 if    sovereign_state=="Ottoman Empire" & year>1550
}

*Tuscany
foreach var in serfdom_inyear serfdom_inyear_smallfree  {
replace `var'=0 if    city2=="SIENA" & year>1300
replace `var'=0 if    city2=="PRATO" & year>1300
replace `var'=0 if    city2=="PISA" & year>1300
replace `var'=0 if    city2=="LIVORNO" & year>1300
replace `var'=0 if    city2=="FIRENZE" & year>1300
replace `var'=0 if    city2=="AREZZO" & year>1300
replace `var'=0 if    city2=="PISTOIA" & year>1300
}




tsset citycode year
encode sovereign_state, gen(statecode)
by citycode: gen lead_statecode=statecode[_n+1]
drop if year<1200
*gen numcities=1
gen numlargecities=0
replace numlargecities=1 if citypop_le5>10000
tab numcities
tab numlargecities

gen medcities=0
replace medcities=1 if citypop_le5>5000

gen communes2=0
replace communes2=1 if medcities==1 & commune_final==1 

preserve
	collapse (sum) numcities numlargecities citypop citypop_le5 commune_final bishop archbishop capitol university medcities communes2 (mean)  muslim prot  latin_west ////
	free_prince_dls constraint_on_the_executive_ajr protection_for_capita ////
	 parliament parl_ai serfdom_inyear serfdom_inyear_smallfree , by(statecode year)
	save sovereigns_cities_rep.dta, replace
restore

preserve
	collapse (sum) numcities citypop citypop_le5 commune_final bishop archbishop capitol university medcities communes2 (mean) muslim prot latin_west  ////
	free_prince_dls constraint_on_the_executive_ajr protection_for_capita ////
	 parliament parl_ai serfdom_inyear serfdom_inyear_smallfree , by(lead_statecode year)
	save lead_sovereigns_cities_rep.dta, replace
restore


use "lead_sovereigns_cities_rep.dta", clear
renvars constraint_on_the_executive_ajr protection_for_capital_ajr \ constraints protcap
renvars numcities citypop citypop_le5 commune_final muslim prot bishop archbishop capitol university latin_west free_prince_dls constraints protcap parliament parl_ai serfdom_inyear serfdom_inyear_smallfree  medcities communes2, prefix(lag_)
rename lead_statecode statecode
save "lead_sovereigns_cities_2_rep.dta", replace


use "sovereigns_cities_rep.dta", clear

tsset statecode year
sort statecode year

merge m:m statecode year using "lead_sovereigns_cities_2_rep.dta"
drop _merge
renvars constraint_on_the_executive_ajr protection_for_capital_ajr \ constraints protcap


foreach var in serfdom_inyear serfdom_inyear_smallfree {
  replace `var'=1 if `var'>0 & `var'<1
 replace `var'=2 if `var'>1 & `var'<2
 replace `var'=4 if `var'>3 & `var'<4
 }

foreach var in serfdom_inyear serfdom_inyear_smallfree ////
  lag_serfdom_inyear lag_serfdom_inyear_smallfree {
 gen `var'2=`var'
 replace `var'2=0 if `var'==.
 }

 foreach var in serfdom_inyear serfdom_inyear_smallfree serfdom_inyear2 serfdom_inyear_smallfree2 {
 gen `var'_any=.
 replace `var'_any=1 if `var'>0
 replace `var'_any=0 if `var'==0
tab `var'_any
}
 
  
foreach var in numcities citypop citypop_le5 commune_final muslim prot bishop archbishop capitol university ////
 latin_west free_prince_dls constraints protcap parliament parl_ai serfdom_inyear serfdom_inyear_smallfree ////
 serfdom_inyear2 serfdom_inyear_smallfree2  {
 gen d_`var'=`var'-lag_`var'
 }
 

***Add colonies/ overseas revenue
gen overseas=0
replace overseas=1 if statecode==45 & year>=1600 /*England*/
replace overseas=1 if statecode==46 & year>=1600 /*England*/
replace overseas=1 if statecode==42 & year>=1700 /*Denmark*/
replace overseas=1 if statecode==107 & year>=1600 /*Netherlands*/
replace overseas=1 if statecode==108 & year>=1600 /*Netherlands*/
replace overseas=1 if statecode==58 & year>=1600 /*France*/
replace overseas=1 if statecode==131 & year>=1500 /*Portugal*/
replace overseas=1 if statecode==154 & year>=1500 /*Spain*/
replace overseas=1 if statecode==155 & year>=1500 /*Spain*/

gen d_overseas=0
replace d_overseas=1 if statecode==45 & year==1600 /*England*/
replace d_overseas=1 if statecode==46 & year==1600 /*England*/
replace d_overseas=1 if statecode==42 & year==1700 /*Denmark*/
replace d_overseas=1 if statecode==107 & year==1600 /*Netherlands*/
replace d_overseas=1 if statecode==108 & year==1600 /*Netherlands*/
replace d_overseas=1 if statecode==58 & year==1600 /*France*/
replace d_overseas=1 if statecode==131 & year==1500 /*Portugal*/
replace d_overseas=1 if statecode==154 & year==1500 /*Spain*/
replace d_overseas=1 if statecode==155 & year==1500 /*Spain*/

*rescale city pop and parliament so coeffs will be about the same size

replace d_citypop_le5=d_citypop_le5/1000000
replace citypop_le5=citypop_le5/1000000

replace d_parl_ai=d_parl_ai/10
replace parl_ai=parl_ai/10

replace muslim=muslim*100
replace prot=prot*100

gen propcommune=(communes2/medcities)
gen lag_propcommune=(lag_communes2/lag_medcities)

gen d_propcommune=propcommune-lag_propcommune



replace d_numcities=d_numcities/100
replace numcities=numcities/100

save "serfdom_regress_data.dta", replace


***Regressions*****

set scheme plotplain

global dvars d_parliament d_parl_ai d_citypop_le5  d_prot d_muslim d_constraints d_protcap d_overseas i.year


global dvars2 d_parliament d_parl_ai  d_numcities d_prot d_muslim d_constraints d_protcap d_overseas i.year

global dvars3 d_parliament d_parl_ai  d_citypop_le5 d_prot d_muslim d_constraints d_protcap d_overseas d_propcommune i.year


global expvars parliament parl_ai overseas citypop_le5  prot muslim constraints protcap ibn.year

global expvars2 parliament parl_ai overseas  numcities prot muslim constraints protcap ibn.year

global expvars3 parliament parl_ai overseas  citypop_le5 prot muslim constraints protcap propcommune ibn.year 

fvset base 1300 year
 
******Figure 4*****
*Figure 4a

 label var serfdom_inyear "Serfdom"
 label var parliament "Parliament"
 label var citypop_le5 "City Population (1,000,000s)"
 label var prot "% Protestant Cities"
 label var constraints "Executive Constraints"
 label var protcap "Protection of Capital"
 label var parl_ai "# Parliament Meetings (10s)"
 label var serfdom_inyear_smallfree "Serfdom (Small States of HRE=0)"
 label var serfdom_inyear2 "Serfdom (NA=0)"
 label var serfdom_inyear_smallfree2 "Serfdom (Small States of HRE=0, NA=0)"
label var muslim "% Muslim Cities" 
label var overseas "Overseas Income"
label variable numcities "# Cities"

set more off 
xtreg serfdom_inyear  $expvars  if year>=1400, fe vce(cluster statecode)
estimates store m1
xtreg serfdom_inyear_smallfree  $expvars  if year>=1400, fe vce(cluster statecode)
estimates store m2
xtreg serfdom_inyear2  $expvars if year>=1400, fe vce(cluster statecode)
estimates store m3
xtreg serfdom_inyear_smallfree2  $expvars  if year>=1400, fe  vce(cluster statecode)
estimates store m4

coefplot (m1, label(S1)) ///
			(m2, label(S2)) ///
			(m3, label(S3)) ///
			(m4, label(S4)) ///
			,  xline(0) keep(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5 ) ////
			levels(95 90) order( constraints protcap overseas prot muslim parliament parl_ai  citypop_le5 ) title(A. Level of Serfdom)

gr save "Figure_4a", replace



*Figure 4b
label var d_serfdom_inyear "Change Serfdom"
 label var d_parliament "Change Parliament"
 label var d_citypop_le5 "Change City Population (millions)"
 label var d_prot "Change % Protestant Cities"
 label var d_constraints "Change Executive Constraints"
 label var d_protcap "Change Protection of Capital"
 label var d_parl_ai "Change # Parliament Meetings (10s)"
 label var d_serfdom_inyear_smallfree "Change Serfdom (Small States of HRE=0)"
 label var d_serfdom_inyear2 "Change Serfdom (NA=0)"
 label var d_serfdom_inyear_smallfree2 "Change Serfdom (Small States of HRE=0, NA=0)"
label var d_muslim "Change % Muslim Cities" 
label var d_overseas "Change Overseas Income"
label var d_numcities "Change # Cities (100s)"
label var d_commune_final "Change # Comunes"
 
xtreg d_serfdom_inyear  $dvars,  vce(cluster statecode)
estimates store m1
xtreg d_serfdom_inyear_smallfree  $dvars,  vce(cluster statecode)
estimates store m2
xtreg d_serfdom_inyear2  $dvars,  vce(cluster statecode)
estimates store m3
xtreg d_serfdom_inyear_smallfree2  $dvars,  vce(cluster statecode)
estimates store m4


coefplot (m1, label(S1)) ///
			(m2, label(S2)) ///
			(m3, label(S3)) ///
			(m4, label(S4)) ///
			, xline(0) drop(1300.year 1400.year 1500.year 1600.year 1700.year _cons) ////
			levels(95 90) order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5 d_numcities) title(B. Change in Serfdom)

gr save "Figure_4b",  replace

gr combine "Figure_4a" "Figure_4b", col (1)

gr export "Figure_4.pdf"

****************************************
 

**Statistics in the text on pages 28-31 
*Levels
xtreg serfdom_inyear  $expvars if year>=1400, fe vce(cluster statecode)
summarize constraints  if e(sample)==1, detail
margins, at(constraints=(0)) 
margins, at(constraints=(.96379))  

summarize protcap  if e(sample)==1, detail
margins, at(protcap=(0)) 
margins, at(protcap=(.9235715))  

summarize citypop_le5  if e(sample)==1, detail
margins, at(citypop_le5=(0)) 
margins, at(citypop_le5=(.5380319))  
 
*Change

xtreg d_serfdom_inyear  $dvars,   vce(cluster statecode)

summarize d_constraints  if e(sample)==1, detail
margins, at(d_constraints=(0)) 
margins, at(d_constraints=(.2242733))  

summarize d_protcap  if e(sample)==1, detail
margins, at(d_protcap=(0)) 
margins, at(d_protcap=(.2641983))  



summarize d_citypop_le5  if e(sample)==1, detail
margins, at(d_citypop_le5=(0)) 
margins, at(d_citypop_le5=(.3859878))  


 **** Statistics on Page 30


import excel "cantoni_prot_1600_v2.xlsx", sheet("Sheet1") firstrow clear

gen serfdom1517_1600=0
replace serfdom1517_1600=1 if serfdom1517==0 & serfdom1532>0
replace serfdom1517_1600=1 if serfdom1517==0 & serdom1538>0
replace serfdom1517_1600=1 if serfdom1517==0 & serfdom1548>0
replace serfdom1517_1600=1 if serfdom1517==0 & serfdom1555>0
replace serfdom1517_1600=1 if serfdom1517==0 & serfdom1600>0

encode tpye, gen(type)

gen serfdom=0
replace serfdom=1 if serfdom1517>0 | serfdom1532>0 | serdom1538>0 | serfdom1548>0 | ////
serfdom1555>0 | serfdom1600>0 | serfdom1700>0
drop if type==.
*statistics on Catholic and Protestant territories imposing serfdom
tabulate  serfdom prot1600 if type!=8, chi2 column

*statistics on increasing serfdom by religion 
gen change1700_1600=serfdom1700-serfdom1600
gen strongerserf1700=0
replace strongerserf1700=1 if change1700_1600>0

tabulate  strongerserf1700 prot1600 if type!=8, chi2 column

****Sensitivity

use "serfdom_regress_data.dta", replace


**Muslim Benchmark
*change
set more off
sensemakr d_serfdom_inyear  $dvars , treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20) latex("sens_const_muslim_change_m1")  

 sensemakr d_serfdom_inyear $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20)  latex("sens_protcap_muslim_change_m1") 

 
 sensemakr d_serfdom_inyear_smallfree $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20)  latex("sens_const_muslim_change_m2") 

 sensemakr d_serfdom_inyear_smallfree $dvars , treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20) latex("sens_protcap_muslim_change_m2") 

 
 sensemakr d_serfdom_inyear2  $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20) latex("sens_const_muslim_change_m3") 

sensemakr d_serfdom_inyear2 $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20)  latex("sens_protcap_muslim_change_m3") 


sensemakr d_serfdom_inyear_smallfree2  $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20)  latex("sens_const_muslim_change_m4") 

 
sensemakr d_serfdom_inyear_smallfree2 $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20) latex("sens_protcap_muslim_change_m4") 



********************************************************************************************
********************************************************************************************
********************************************************************************************
********************************************************************************************
********************************************************************************************
********************************************************************************************

******************************************************
************* SUPPLEMENTAL INFORMATION ***************
******************************************************

***Levels Fixed effects 
use "serfdom_regress_data.dta", replace

			

*Table A1 	
label var serfdom_inyear "Serfdom"
label var parliament "Parliament"
label var citypop_le5  "Population in Cities (100,000s)"
label var prot "\% Protestant Cities"
label var constraints "Executive Constraints"
label var protcap "Protection of Capital"
label var parl_ai "\# Meetings of Parliament"
label var serfdom_inyear_smallfree "Serfdom (Small States of HRE=0)"
label var serfdom_inyear2 "Serfdom (NA=0)"
label var serfdom_inyear_smallfree2 "Serfdom (Small States of HRE=0, NA=0)"
label var muslim "\% Muslim Cities" 
label var overseas "Overseas Income"
label variable numcities "\# Cities"
label var propcommune "Prop. Communes (per 100 cities)"


	 
eststo clear
 eststo: xtreg serfdom_inyear  $expvars if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree  $expvars if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear2  $expvars if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree2  $expvars if year>=1400, fe vce(cluster statecode)
 
esttab using table_A1.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     replace



*Table A2

 eststo clear
 eststo: xtreg serfdom_inyear  $expvars if year>=1400, fe vce(robust) 
 eststo: xtreg serfdom_inyear_smallfree  $expvars if year>=1400, fe vce(robust) 
 eststo: xtreg serfdom_inyear2  $expvars if year>=1400, fe vce(robust) 
 eststo: xtreg serfdom_inyear_smallfree2  $expvars if year>=1400, fe vce(robust) 
 esttab using table_A2.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     replace

 	 
*Table A3
eststo clear
	 eststo: xtreg serfdom_inyear  $expvars2 if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree  $expvars2 if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear2  $expvars2 if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree2  $expvars2 if year>=1400, fe vce(cluster statecode)
 
 esttab using table_A3.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  numcities)     replace


	  
*Table A4	
 eststo clear
 eststo: xtreg serfdom_inyear  parliament parl_ai overseas citypop_le5 prot muslim c.constraints##i.year c.protcap##i.year if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree  parliament overseas parl_ai citypop_le5 prot muslim c.constraints##i.year c.protcap##i.year if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear2  parliament parl_ai overseas citypop_le5 prot muslim c.constraints##i.year c.protcap##i.year if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree2  parliament overseas parl_ai citypop_le5 prot muslim c.constraints##i.year c.protcap##i.year if year>=1400, fe vce(cluster statecode)
 
 esttab using table_A4.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     replace

	 
*Table A5
eststo clear
	 eststo: xtreg serfdom_inyear  $expvars i.statecode if year>=1400 & statecode!=69 & statecode!=78,   vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree  $expvars i.statecode if year>=1400 & statecode!=69 & statecode!=78,  vce(cluster statecode)
 eststo: xtreg serfdom_inyear2  $expvars i.statecode if year>=1400 & statecode!=69 & statecode!=78, fe  vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree2  $expvars i.statecode if year>=1400 &statecode!=69 & statecode!=78,   vce(cluster statecode)
 
esttab using table_A5.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)  keep(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5 1400.year 1500.year 1600.year 1700.year)   replace


	  

	 
*Table A6 
 eststo clear
 eststo: oprobit serfdom_inyear  $expvars if year>=1400, vce(cluster statecode)
 eststo: oprobit serfdom_inyear_smallfree  $expvars if year>=1400, vce(cluster statecode)
 eststo: oprobit serfdom_inyear2  $expvars if year>=1400,  vce(cluster statecode)
 eststo: oprobit serfdom_inyear_smallfree2  $expvars if year>=1400,  vce(cluster statecode)
 
 esttab using table_A6.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     keep(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5 1400.year 1500.year 1600.year 1700.year)   replace


	 


	 
	 
	 
*Table A7
 eststo clear
 eststo: xtreg serfdom_inyear_any  $expvars if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree_any  $expvars if year>=1400, fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear2_any  $expvars if year>=1400,  fe vce(cluster statecode)
 eststo: xtreg serfdom_inyear_smallfree2_any  $expvars if year>=1400,  fe vce(cluster statecode)
 
 esttab using table_A7.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     replace



*Table A8	 
eststo clear
eststo: xtreg serfdom_inyear  $expvars3 if year>=1400, fe vce(cluster statecode)
eststo: xtreg serfdom_inyear_smallfree  $expvars3 if year>=1400, fe vce(cluster statecode)
eststo: xtreg serfdom_inyear2  $expvars3 if year>=1400, fe vce(cluster statecode)
eststo: xtreg serfdom_inyear_smallfree2  $expvars3 if year>=1400, fe vce(cluster statecode)
 
 esttab using table_A8.tex, b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order(constraints protcap overseas prot muslim parliament parl_ai  citypop_le5)     replace



		
*Table A9 
 label var d_serfdom_inyear "$\Delta$ Serfdom"
 label var d_parliament "$\Delta$ Parliament"
 label var d_citypop_le5 "$\Delta$ Population in Cities (millions)"
 label var d_prot "$\Delta$ \% Protestant Cities"
 label var d_constraints "$\Delta$ Executive Constraints"
 label var d_protcap "$\Delta$ Protection of Capital"
 label var d_parl_ai "$\Delta$ \# Meetings of Parliament (10s)"
 label var d_serfdom_inyear_smallfree "$\Delta$ Serfdom (Small States of HRE=0)"
 label var d_serfdom_inyear2 "$\Delta$ Serfdom (NA=0)"
 label var d_serfdom_inyear_smallfree2 "$\Delta$ Serfdom (Small States of HRE=0, NA=0)"
label var d_muslim "$\Delta$ \% Muslim Cities" 
label var d_overseas "$\Delta$ Overseas Income" 
label var d_numcities "$\Delta$ \# Cities (100s)"
label var d_propcommune "$\Delta$ Prop. Communes (per 100 cities)"


eststo clear
eststo: xtreg d_serfdom_inyear  $dvars,   vce(cluster statecode)
eststo: xtreg d_serfdom_inyear_smallfree  $dvars,   vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear2  $dvars, vce(cluster statecode)
eststo: xtreg d_serfdom_inyear_smallfree2  $dvars,   vce(cluster statecode)

esttab using table_A9.tex,  b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)   drop(1300.year)  replace

*Table A10

eststo clear
eststo: xtreg d_serfdom_inyear  $dvars,  vce(robust) 
eststo: xtreg d_serfdom_inyear_smallfree  $dvars, vce(robust)
eststo: xtreg d_serfdom_inyear2  $dvars,  vce(robust)
eststo: xtreg d_serfdom_inyear_smallfree2  $dvars,  vce(robust)

esttab using table_A10.tex,   b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)  drop(1300.year)   replace


	 
*Table A11

 eststo clear
eststo: xtreg d_serfdom_inyear  $dvars2,  vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear_smallfree  $dvars2, vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear2  $dvars2,   vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear_smallfree2  $dvars2,   vce(cluster statecode) 

esttab using table_A11.tex,   b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai )   drop(1300.year)  replace

	 
	 
*Table A12
eststo clear
eststo: xtreg d_serfdom_inyear d_parliament d_parl_ai d_citypop_le5  d_prot d_muslim c.d_constraints##i.year c.d_protcap##i.year  d_overseas i.year,  vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear_smallfree  d_parliament d_parl_ai d_citypop_le5  d_prot d_muslim c.d_constraints##i.year c.d_protcap##i.year  d_overseas i.year, vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear2  d_parliament d_parl_ai d_citypop_le5  d_prot d_muslim c.d_constraints##i.year c.d_protcap##i.year d_overseas i.year,   vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear_smallfree2  d_parliament d_parl_ai d_citypop_le5  d_prot d_muslim c.d_constraints##i.year c.d_protcap##i.year  d_overseas i.year,   vce(cluster statecode) 

esttab using table_A12.tex,  b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)     replace


*Table A13
 eststo clear
eststo: xtreg d_serfdom_inyear  $dvars if statecode!=69 & statecode!=78,  vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear_smallfree  $dvars if statecode!=69 & statecode!=78, vce(cluster statecode)
eststo: xtreg d_serfdom_inyear2  $dvars if statecode!=69 & statecode!=78,  vce(cluster statecode)
eststo: xtreg d_serfdom_inyear_smallfree2  $dvars if statecode!=69 & statecode!=78,  vce(cluster statecode)

esttab using table_A13.tex,   b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)   keep( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)  replace


*Table A14
eststo clear
eststo: xtreg d_serfdom_inyear  $dvars3,   vce(cluster statecode)
eststo: xtreg d_serfdom_inyear_smallfree  $dvars3,   vce(cluster statecode) 
eststo: xtreg d_serfdom_inyear2  $dvars3, vce(cluster statecode)
eststo: xtreg d_serfdom_inyear_smallfree2  $dvars3,   vce(cluster statecode)
esttab using table_A14.tex,   b(2) se(2) scalars("r2_w R$^{2}$") label  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) nonumbers nomtitles nolines nogaps  prefoot(\hline) fragment  noomitted order( d_constraints d_protcap d_overseas d_prot d_muslim d_parliament d_parl_ai  d_citypop_le5)   drop(1300.year)  replace

********************************************************************************************
********* FIGURES A1-A8 ****************


*what explains change in executive constraints & protection of capital 
reg d_constraints d_parliament d_overseas d_parl_ai d_citypop_le5 ////
d_prot d_muslim  d_protcap  i.year

reg d_protcap  d_parliament d_overseas d_parl_ai d_citypop_le5 ////
d_prot d_muslim d_constraints  i.year

************* FIGURE A1 ***************

set more off
sensemakr d_serfdom_inyear  $dvars , treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20) contourplot
gr export "figure_A1a.pdf", replace

sensemakr d_serfdom_inyear_smallfree $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20)  contourplot
gr export "figure_A1b.pdf", replace


sensemakr d_serfdom_inyear2  $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20) contourplot
gr export "figure_A1c.pdf", replace



sensemakr d_serfdom_inyear_smallfree2  $dvars, treat(d_constraints) ////
 benchmark(d_muslim) kd(1 10 20)   contourplot
gr export "figure_A1d.pdf", replace


************* FIGURE A2 ***************


 sensemakr d_serfdom_inyear $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20)  contourplot
gr export "figure_A2a.pdf", replace
 
 
 sensemakr d_serfdom_inyear_smallfree $dvars , treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20) contourplot
gr export "figure_A2b.pdf", replace

 
sensemakr d_serfdom_inyear2 $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20)  contourplot
gr export "figure_A2c.pdf", replace

 
sensemakr d_serfdom_inyear_smallfree2 $dvars, treat(d_protcap) ////
 benchmark(d_muslim) kd(1 10 20)  contourplot
gr export "figure_A2d.pdf", replace




************* FIGURE A3 ***************

set more off
sensemakr serfdom_inyear  $expvars i.statecode, treat(constraints) ////
 benchmark(muslim)    contourplot
gr export "figure_A3a.pdf", replace


sensemakr serfdom_inyear_smallfree $expvars i.statecode, treat(constraints) ////
 benchmark(muslim)    contourplot
gr export "figure_A3b.pdf", replace

sensemakr serfdom_inyear2  $expvars i.statecode, treat(constraints) ////
 benchmark(muslim)   contourplot
gr export "figure_A3c.pdf", replace

 

sensemakr serfdom_inyear_smallfree2  $expvars i.statecode, treat(constraints) ////
 benchmark(muslim)   contourplot
gr export "figure_A3d.pdf", replace


************* FIGURE A4 ***************

 sensemakr serfdom_inyear $expvars i.year i.statecode, treat(protcap) ////
 benchmark(muslim)   contourplot
gr export "figure_A4a.pdf", replace

 
  
sensemakr serfdom_inyear_smallfree $expvars i.statecode, treat(protcap) ////
 benchmark(muslim)  contourplot
gr export "figure_A4b.pdf", replace

  
sensemakr serfdom_inyear2 $expvars i.statecode, treat(protcap) ////
 benchmark(muslim)  contourplot
gr export "figure_A4c.pdf", replace

 
sensemakr serfdom_inyear_smallfree2 $expvars i.statecode, treat(protcap) ////
 benchmark(muslim)  contourplot
gr export "figure_A4d.pdf", replace


************* FIGURE A5 ***************

sensemakr d_serfdom_inyear  $dvars, treat(d_constraints) ////
 benchmark(d_citypop_le5)  contourplot
gr export "figure_A5a.pdf", replace


 sensemakr d_serfdom_inyear_smallfree $dvars, treat(d_constraints) ////
 benchmark(d_citypop_le5) contourplot
gr export "figure_A5b.pdf", replace

sensemakr d_serfdom_inyear2 $dvars, treat(d_constraints) ////
 benchmark(d_citypop_le5) contourplot
gr export "figure_A5c.pdf", replace


sensemakr d_serfdom_inyear_smallfree2  $dvars, treat(d_constraints) ////
 benchmark(d_citypop_le5) contourplot
gr export "figure_A5d.pdf", replace
 
 
************* FIGURE A6 ***************

 sensemakr d_serfdom_inyear $dvars, treat(d_protcap) ////
 benchmark(d_parl_ai) contourplot
gr export "figure_A6a.pdf", replace

 
 sensemakr d_serfdom_inyear_smallfree $dvars, treat(d_protcap) ////
 benchmark(d_parl_ai) contourplot
gr export "figure_A6b.pdf", replace

 
sensemakr d_serfdom_inyear2 $dvars, treat(d_protcap) ////
 benchmark(d_parl_ai)  contourplot
gr export "figure_A6c.pdf", replace

 
sensemakr d_serfdom_inyear_smallfree2 $dvars, treat(d_protcap) ////
 benchmark(d_parl_ai) contourplot
gr export "figure_A6d.pdf", replace


************* FIGURE A7 ***************

sensemakr serfdom_inyear  $expvars i.statecode, treat(constraints) ////
 benchmark(citypop_le5)  contourplot
gr export "figure_A7a.pdf", replace

sensemakr serfdom_inyear_smallfree  $expvars i.statecode, treat(constraints) ////
 benchmark(citypop_le5) contourplot
gr export "figure_A7b.pdf", replace

sensemakr serfdom_inyear2  $expvars i.statecode, treat(constraints) ////
 benchmark(citypop_le5) contourplot
gr export "figure_A7c.pdf", replace


sensemakr serfdom_inyear_smallfree2  $expvars i.statecode, treat(constraints) ////
 benchmark(citypop_le5) contourplot
gr export "figure_A7d.pdf", replace



************* FIGURE A8 ***************
 sensemakr serfdom_inyear $expvars i.statecode, treat(protcap) ////
 benchmark(parl_ai) contourplot
gr export "figure_A8a.pdf", replace

  
sensemakr serfdom_inyear_smallfree $expvars i.statecode, treat(protcap) ////
 benchmark(parl_ai)  contourplot
gr export "figure_A8b.pdf", replace

 
sensemakr serfdom_inyear2 $expvars i.statecode, treat(protcap) ////
 benchmark(parl_ai)  contourplot
gr export "figure_A8c.pdf", replace


 
sensemakr serfdom_inyear_smallfree2 $expvars i.statecode, treat(protcap) ////
 benchmark(parl_ai)  contourplot
gr export "figure_A8d.pdf", replace





********************************************************************************************
************* FIGURE A9 ***************

*from gis, uses map data I am unable to share

************* FIGURE A10 ***************


import excel "Plague outbreaks_biraben_for_stata.xls", sheet("All data") firstrow clear

destring France, replace
destring EnglandScotlandIreland, replace 
destring BelgiumNetherlandsLuxembourg, replace 
destring GermanyAustriaBohemiaSwitzerl, replace 
destring PolandBaltics, replace
destring SouthEastRussiaUkraineCaucus, replace

egen totaleurope=rowtotal(SpainPortugal ItalyMalta France EnglandScotlandIreland   ////
 BelgiumNetherlandsLuxembourg   GermanyAustriaBohemiaSwitzerl   PolandBaltics   ////
 NorwaySwedenDenmarkFinlandIc   HungaryCroatiaSloveniaDalmati   NorthwestRussia   ////
 SouthEastBalkans   SouthEastRussiaUkraineCaucus)

egen totalrussia= rowtotal(SouthEastRussiaUkraineCaucus NorthwestRussia)

renvars EnglandScotlandIreland BelgiumNetherlandsLuxembourg ////
GermanyAustriaBohemiaSwitzerl PolandBaltics NorwaySwedenDenmarkFinlandIc HungaryCroatiaSloveniaDalmati ////
NorthwestRussia SouthEastBalkans SouthEastRussiaUkraineCaucus \ UK LowCountries Germanic Poland Nordic ////
EastHapsburg NWRussia SEBalkans SERussia

rename Year year

tsset year

summarize totaleurope if year<=1750, detail
summarize totaleurope if year<=1352, detail
summarize totaleurope if year>=1450 & year<=1650, detail 

summarize totaleurope if year>=1353 & year<=1450, detail 


summarize totaleurope if year>=1650, detail 

foreach var in SpainPortugal ItalyMalta France UK LowCountries Germanic Poland Nordic ////
EastHapsburg NWRussia SEBalkans SERussia totaleurope totalrussia {
gen l1_`var'=`var'[_n-1]
gen l2_`var'=`var'[_n-2]
gen l3_`var'=`var'[_n-3]
gen l4_`var'=`var'[_n-4]
gen l5_`var'=`var'[_n-5]
gen l6_`var'=`var'[_n-6]
gen l7_`var'=`var'[_n-7]
gen l8_`var'=`var'[_n-8]
gen l9_`var'=`var'[_n-9]
egen `var'_tot10year=rowtotal(`var' l1_`var' l2_`var' l3_`var' l4_`var' l5_`var' l6_`var' l7_`var' l8_`var' l9_`var')
gen `var'_aveg10year=`var'_tot10year/10
}
 
keep if year==1350 | year==1360 | year==1370 | year==1380 | year==1390 | year==1400 | year==1410 | year==1420 | year==1430 | year==1440 | ////
year==1450 | year==1460 | year==1470 | year==1480 | year==1490 | year==1500 | year==1510 | year==1520 | year==1530 | year==1540 | ////
year==1550 | year==1560 | year==1570 | year==1580 | year==1590 | year==1600 | year==1610 | year==1620 | year==1630 | year==1640 | ////
year==1650 | year==1660 | year==1670 | year==1680 | year==1690 | year==1700 | year==1710 | year==1720 | year==1730 | year==1740 | ////
year==1750 | year==1760 | year==1770 | year==1780 | year==1790 | year==1800 | year==1810 | year==1820


egen westeurope_tot10year=rowtotal(SpainPortugal_tot10year UK_tot10year France_tot10year LowCountries_tot10year)
egen centeurope_tot10year=rowtotal(Germanic_tot10year ItalyMalta_tot10year Nordic_tot10year)
egen easteurop_tot10year=rowtotal(Poland_tot10year EastHapsburg_tot10year SEBalkans_tot10year)

 
twoway (line totaleurope_tot10year year, lcolor(black)) (line westeurope_tot10year year, lcolor(black) lpattern(dash)) ////
(line centeurope_tot10year year, lcolor(black) lpattern(shortdash_dot) ) , ////
legend(off)  ////
xtitle("Year") ytitle("Outbreaks (Decade Total)") text(180 1400 "All Europe", size(vsmall))  yscale(range(0 700))   ylabel(0(100)700) ////
	 text(120 1500 "West Europe", size(vsmall)) text(30 1470 "Central Europe", size(vsmall))
gr export "Figure_A10a.pdf", replace


	 
	 
twoway (line easteurop_tot10year year, lcolor(black) lpattern(dash) ) ////
(line totalrussia_tot10year year, lcolor(black) lpattern(shortdash_dot) ) , ////
 legend(off)  ////
xtitle("Year") ytitle("Regional Outbreaks (Decade Total)")  yscale(range(0 100))   ylabel(0(20)100) ////
	 text(15 1500 "East Europe", size(vsmall)) text(6 1520 "Russia", size(vsmall))
	 
gr export "Figure_A10b.pdf", replace


************* FIGURE A11 ***************

*from gis, uses map data I am unable to share

************* FIGURE A12 ***************

*Copied from Abel (1966), using under fair use
